<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-zhDeptInfo-edit" th:object="${zhDeptInfo}">
            <input id="id" name="id" th:field="*{id}"  type="hidden">
<!--			<div class="form-group">	-->
<!--				<label class="col-sm-3 control-label">唯一标识：</label>-->
<!--				<div class="col-sm-8">-->
<!--					<input id="uuid" name="uuid" th:field="*{uuid}" class="form-control" type="text">-->
<!--				</div>-->
<!--			</div>-->
			<div class="form-group">	
				<label class="col-sm-3 control-label">域名：</label>
				<div class="col-sm-8">
					<input id="domain" name="domain" th:field="*{domain}" class="form-control" type="text">
				</div>

			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">站长手机号：</label>
				<div class="col-sm-8">
					<input id="phone" name="phone" class="form-control" type="text" th:field="*{phone}">
				</div>
			</div>


			<div class="form-group">
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<textarea id="remark" name="remark" class="form-control" th:field="*{remark}"></textarea>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">名称：</label>
				<div class="col-sm-8">
					<input id="name" name="name" th:field="*{name}" class="form-control" type="text">
				</div>
			</div>


			<div class="form-group" style="display: none;">
				<label class="col-sm-3 control-label">logo图片地址：</label>
				<div class="col-sm-8">
					<input id="logoUrl" name="logoUrl" class="form-control img_upload" type="text">
				</div>
			</div>

			<div class="form-group" >
				<label class="col-sm-3 control-label">logo图片(建议尺寸：300x120)：</label>
				<button type="button" class="layui-btn upload" id="logoUrl_upload" style="margin-left: 15px;">
					<i class="layui-icon">&#xe67c;</i>上传图片
				</button>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">logo图片预览：</label>
				<img th:src="${zhDeptInfo.logoUrl}" id="logoUrl_upload_preview" height="100" width="150" style="cursor: pointer;margin-left: 15px;" class="preview"/>
			</div>


			<div class="form-group"  style="display: none;">
				<label class="col-sm-3 control-label">广告横幅：</label>
				<div class="col-sm-8">
					<input id="adUrl" name="adUrl" class="form-control img_upload" type="text">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">广告横幅图片(建议尺寸：1425x100)：</label>
				<button type="button" class="layui-btn upload" id="adUrl_upload" style="margin-left: 15px;">
					<i class="layui-icon">&#xe67c;</i>上传图片
				</button>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">广告横幅预览：</label>
				<img th:src="${zhDeptInfo.adUrl}" id="adUrl_upload_preview" height="100" width="150" style="cursor: pointer;margin-left: 15px;" class="preview"/>
			</div>

			<div class="form-group"  style="display: none;">
				<label class="col-sm-3 control-label">客服微信二维码：</label>
				<div class="col-sm-8">
					<input id="wechatQrcode" name="wechatQrcode" class="form-control img_upload" type="text">
				</div>
			</div>

			<div class="form-group" >
				<label class="col-sm-3 control-label">客服微信二维码(建议尺寸：120x120)：</label>
				<button type="button" class="layui-btn upload" id="wechatQrcode_upload" style="margin-left: 15px;">
					<i class="layui-icon">&#xe67c;</i>上传图片
				</button>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">客服微信二维码预览：</label>
				<img th:src="${zhDeptInfo.wechatQrcode}" id="wechatQrcode_upload_preview" height="100" width="150" style="cursor: pointer;margin-left: 15px;" class="preview"/>
			</div>

			<div class="form-group"  style="display: none;">
				<label class="col-sm-3 control-label">客服qq二维码：</label>
				<div class="col-sm-8">
					<input id="qqQrcode" name="qqQrcode" class="form-control img_upload" type="text">
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">客服qq二维码(建议尺寸：120x120)：</label>
				<button type="button" class="layui-btn upload" id="qqQrcode_upload" style="margin-left: 15px;">
					<i class="layui-icon">&#xe67c;</i>上传图片
				</button>
			</div>

			<div class="form-group">
				<label class="col-sm-3 control-label">客服qq二维码预览：</label>
				<img th:src="${zhDeptInfo.qqQrcode}" id="qqQrcode_upload_preview" height="100" width="150" style="cursor: pointer;margin-left: 15px;" class="preview"/>
			</div>
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "system/zhDeptInfo";
		$("#form-zhDeptInfo-edit").validate({
			rules:{
				xxxx:{
					required:true,
				},
			}
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/edit", $('#form-zhDeptInfo-edit').serialize());
	        }
	    }
	</script>

	<script type="text/javascript">

		layui.use('upload', function(){
			var preview_img =$('.preview')
			preview_img.on("click",function(e){
				layer.photos({ photos: {"data": [{"src": e.target.src}]} });
			});
			var upload = layui.upload;
			var layer = layui.layer;
			// 图片上传，注意组件的id、class规则
			var uploadImgs = $('.img_upload');
			$(uploadImgs).each(function (index, item) {
				var id = item.id;
				var address_element=$(item);
				var upload_element = $('#{0}_upload'.format(id));
				var preview_element= $('#{0}_upload_preview'.format(id));
				renderUpload(upload,upload_element,preview_element,address_element)
			})
			// renderUpload(upload,$('#logoUrl_upload'),$('#logoUrl_upload_preview'),$('#logoUrl'));
		});
	</script>

</body>
</html>
